<!DOCTYPE html>
<html>
<head>
<title>消息模板</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<#include "../../../include/resources.html">
<script type="text/javascript">
	var dataGrid;
	var winWidth = 700;
	var winHeight = 500;
	var addTitle = "添加";
	var addUrl =  "/modules/system/noticeType/addPage.html";
	var addWinParmeters = "'{0}','"+addTitle+"',"+winWidth+","+winHeight+",'"+addUrl+"'";
	var editTitle = "编辑";
	var editUrl =  "/modules/system/noticeType/editPage.html";

	var deleteUrl = "/modules/system/noticeType/delete.html?send=0";
	var deleteMsg = "是否停用发送？"	;
	var openUrl = "/modules/system/noticeType/delete.html?send=1";	
	var openMsg = "是否启用发送？";
	$(function() {
		var editIndex = undefined;
		dataGrid = $('#dataGrid').datagrid({
			url : 'list.html',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : pageSize,
			pageNums :1,
			pageList : pageList,
			checkOnSelect : false,
			selectOnCheck : false,
			nowrap : false,
			singleSelect:true,
			columns : [ [ 	
				{ field: 'id', title: '编号', width: 50, sortable:true},
				{ field: 'nid', title: '类型编码', width: 150,fixed:true},
				{ field: 'noticeType', title: '类型', width: 40,formatter:function(value,row,index){
					if(value==1){
						return "短信";
					}else if(value==2){
						return "邮件";
					}else if(value==3){
						return "站内信";
					}
				}},
				{ field: 'name', title: '名称', width: 120},
				{ field: 'type', title: '系统短信', width: 60, sortable:true,formatter:function(value,row,index){
					if(value==1){
						return "系统通知";
					}else if(value==2){
						return "用户通知";
					}else{
						return "其它类型";
					}
				}},
				{ field: 'send', title: '是否启用', width: 50,formatter:function(value,row,index){
					if(value==1){
						return "启用";
					}else{
						return "禁用";
					}
				}},
				{ field: 'remark', title: '备注', width:220,sortable:true},
				{ field : 'showInfo',
	                title : '其他信息',
	                width :75,
	                align:'center',
	                fixed:true,
	                formatter : function(value, row, index) {
						var content = '<a href="javascript:void(0);" class="j-showInfo">查看<i class="iconfont">&#xe639;</i></a>'
							+ '<div class="showInfoSingleDiv">'
							+ '<div class="showInfo">'
							+ '<em></em><h2>消息模板</h2>'
							+ '<ul>'
							+ '<li>'
	                		+ '<span>标题模板：</span>'
							+ row.titleTemplet
							+ '</li>'
							+ '<li>'
	                		+ '<span>内容：</span>'
							+ row.templet
							+ '</li>'
							+ '</ul></div></div>';
						return content;
					}
				},
				{field : 'action',title : '操作',width :70,align:'center',fixed:true,
					formatter : function(value, row, index) {
						var str = '';
						str += '<dl>';
						str += '<dt><a href="javascript:void(0);">详情</a><i class="iconfont">&#xe639;</i></dt>' ;
						str += '<dd>';
						str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.editFun('+row.id+',editTitle,winWidth,winHeight,editUrl);" title="'+editTitle+'">编辑</a>';
						if(row.send==1)
						{
							str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.deleteFun('+row.id+',deleteUrl,deleteMsg);">停用</a>';
						}
						else
						{
							str += '<a href="javascript:void(0);" onclick="$.fn.dataGridOptions.deleteFun('+row.id+',openUrl,openMsg);">启用</a>';
						}
						str += '</dd>'
						str +=  '</dl>'
						return str;
					}
				} 
			 ] ],
			toolbar : '#toolbar',
			onLoadSuccess : function() {
				$('#searchForm table').show();
				parent.$.messager.progress('close');
			}
		});
	});

	
</script>
</head>
<body style="padding:0 20px;" >
	<div class="easyui-layout" data-options="fit : true,border : false">
		<div data-options="region:'north',border:false,collapsible:false" id="searchBox">
        	<div class="sLeft">
	            <form id="searchForm">
	            	<span>类型</span>
	            	<select name="nid" class="type">
							<#list dictList as item>
							<option value="${item.value}">${item.name}</option>
							</#list>
					</select>
					<span>状态</span>
					<select name="send" class="status">
						<option value="99">全部</option>
						<option value="1" selected="selected">启用</option>
						<option value="0">禁用</option>
					</select>
					<span>通知类型</span>
					<select name="noticeType" class="status">
						<option value="99">全部</option>
						<option value="1" selected="selected">短信</option>
						<option value="2">邮件</option>
						<option value="3">站内信</option>
					</select>
					<a href="javascript:void(0);" class="searchBtn sBtn sureBtn" onclick="$.fn.dataGridOptions.searchFun('#searchForm');">确定</a>
					<a href="javascript:void(0);" class="reloadIcon" onclick="dataGrid.datagrid('reload');" title="刷新" ><i class="iconfont">&#xe603;</i></a>
	            </form>
            </div>
            <div class="sRight">
				<a onclick="$.fn.dataGridOptions.addFun(-1,addTitle,winWidth,winHeight,addUrl);" href="javascript:void(0);" class="addBtn"><i class="iconfont">&#xe629;</i>添加</a>						
            </div>
		</div>
		<div data-options="region:'center'" style="margin-top:30px;padding-bottom:30px;">
			<table id="dataGrid"></table>
		</div>
	</div>
</body>
</html>
<script src="${theme_dir}/js/search.js"></script>